home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / demos / GL / libdemo / slider.h < prev    next >
Text File  |  1994-08-01  |  3KB  |  71 lines

  1. /*
  2.  * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. /*
  18.  * Definitions for slider bar routines
  19.  * Written by Thant Tessman, modified a bit by Gavin Bell
  20.  * for Silicon Graphics
  21.  */
  22.  
  23. #define SLIDER_INT 0
  24. #define SLIDER_FLOAT 1
  25. typedef union { int i; float f; } sliderval;
  26.  
  27. /*
  28.  * This routine is used to add a new slider bar to the current window.
  29.  * It returns a generic pointer (to a slider structure defined in
  30.  * slider.c that you should never have to mess with).
  31.  * 
  32.  * Arguments are:
  33.  *
  34.  * title            : a printf-style string used as the title of the
  35.  *                    slider.  It should contain a %d or %f, which will
  36.  *                    be replaced with the current value.
  37.  * type             : SLIDER_INT or SLIDER_FLOAT
  38.  * min, max         : Minimum and maximum possible values (should be
  39.  *                    ints or floats cast to type sliderval)
  40.  * variable         : Address of the value that should be changing
  41.  * cornerx, cornery : Location of lower left corner of the slider in
  42.  *                    the window, expressed as a fraction from 0.0 to
  43.  *                    1.0
  44.  * sizex, sizey     : Size of slider, expressed as a fraction of window
  45.  *                    size (0.0 to 1.0).  corner+size shouldn't be
  46.  *                    greater than 1.0, or part of the slider will be
  47.  *                    outside the window.
  48.  * fn               : A function to be called every time the slider
  49.  *                    value changes.  The function will be called
  50.  *                    before the slider is drawn.
  51.  *
  52.  * This routine adds events and updates to almost totally take care of
  53.  * the slider for you.  The following example creates an integer
  54.  * valued, RGB slider in its own window.  Its initial value will be
  55.  * whatever the value of  an_int  is.
  56.  *
  57.  * gid = winopen(sliderwin);
  58.  * RGBmode(); doublebuffer(); gconfig();
  59.  * add_slider("Value: %d",SLIDER_INT, (float)0, (float)255,
  60.  *             (sliderval *)&an_int, 0.0, 0.0, 1.0, 1.0, NULL);
  61.  */
  62. char *add_slider(char *title, int type, float min, float max,
  63.     sliderval *variable, float cornerx, float cornery,
  64.     float sizex, float sizey, void (*fn)());
  65.  
  66. /*
  67.  * This routine is provided to update a slider when it's value changes
  68.  * due to something outside of its control.
  69.  */
  70. void draw_slider(char *s);
  71.